<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="main" />
<title>Welcome to Grails</title>
<style type="text/css" media="screen">
#status {
	background-color: #eee;
	border: .2em solid #fff;
	margin: 2em 2em 1em;
	padding: 1em;
	width: 12em;
	float: left;
	-moz-box-shadow: 0px 0px 1.25em #ccc;
	-webkit-box-shadow: 0px 0px 1.25em #ccc;
	box-shadow: 0px 0px 1.25em #ccc;
	-moz-border-radius: 0.6em;
	-webkit-border-radius: 0.6em;
	border-radius: 0.6em;
}

.ie6 #status {
	display: inline;
	/* float double margin fix http://www.positioniseverything.net/explorer/doubled-margin.html */
}

#status ul {
	font-size: 0.9em;
	list-style-type: none;
	margin-bottom: 0.6em;
	padding: 0;
}

#status li {
	line-height: 1.3;
}

#status h1 {
	text-transform: uppercase;
	font-size: 1.1em;
	margin: 0 0 0.3em;
}

#page-body {
	margin: 2em 1em 1.25em 18em;
}

h2 {
	margin-top: 1em;
	margin-bottom: 0.3em;
	font-size: 1em;
}

p {
	line-height: 1.5;
	margin: 0.25em 0;
}

#controller-list ul {
	list-style-position: inside;
}

#controller-list li {
	line-height: 1.3;
	list-style-position: inside;
	margin: 0.25em 0;
}

#Admin {
display:none;
}
#LJ {
display:none;
}
#Vendor{
display:none;
}

@media screen and (max-width: 480px) {
	#status {
		display: none;
	}
	#page-body {
		margin: 0 1em 1em;
	}
	#page-body h1 {
		margin-top: 0;
	}
}
</style>
<script  type="text/javascript">
function changeView(){
if(UserList.value == "Admin") {
	Admin.style.cssText= "display:inline;" 
	LJ.style.cssText = "display:none;"
	Vendor.style.cssText = "display:none;"
}
else if(UserList.value == "Vendor") {
	Admin.style.cssText= "display:none;" 
		LJ.style.cssText = "display:none;"
		Vendor.style.cssText = "display:inline;"
}

else if(UserList.value == "LJ") {
	Admin.style.cssText= "display:none;" 
		LJ.style.cssText = "display:inline;"
		Vendor.style.cssText = "display:none;"
}
else if(UserList.value == "select") {
	Admin.style.cssText= "display:none;" 
		LJ.style.cssText = "display:none;"
		Vendor.style.cssText = "display:none;"
}
	
}
</script>
</head>
<body>
	<sec:ifNotLoggedIn>
		<form method="POST"
			action="${resource(file: 'j_spring_security_check')}">
			<table>
				<tr>
					<td><p>Login</p></td>
				</tr>
				<tr>
					<td>Username:</td>
					<td><g:textField name="j_username" /></td>
				</tr>
				<tr>
					<td>Password:</td>
					<td><input name="j_password" type="password" /></td>
				</tr>
				<tr>
					<td colspan="2"><g:submitButton name="login" value="Login" /></td>
				</tr>
			</table>
		</form>
		<table>
			<tr>
				<td><p>Register an Account</p></td>
			</tr>
			<tr>
				<td>Type of User:</td>
				<td><select id="UserList" onchange="changeView()">
						<option value="select">Select One...</option>
						<option value="Admin">Administrator</option>
						<option value="Vendor">Vendor</option>
						<option value="LJ">Little Johnny</option>
				</select></td>
			</tr>
		</table>
		<div id="Admin">
			<form name="register" controller="LoginController" action="index2">
				<table>
					<tr>
						<td>Username:</td>
						<td><input name="username" value="${username}" /></td>
					</tr>
					<tr>
						<td>Password:</td>
						<td><input name="password" value="${password}"
							type="password" /></td>
					</tr>
					<tr>
						<td>Confirm Password:</td>
						<td><input name="passwordCheck" type="password" /></td>
					</tr>
					<tr>
						<td colspan="2"><g:submitButton name="create" value="Create" /></td>
					</tr>

				</table>
			</form>
		</div>

		<div id="Vendor">
			<form name="register" controller="LoginController" action="index2">
				<table>
					<tr>
						<td>First Name:</td>
						<td><input name="fName" value="${fName}" /></td>
					</tr>
					<tr>
						<td>Last Name:</td>
						<td><input name="lName" value="${lName}" /></td>
					</tr>
					<tr>
						<td>Company/Organization:</td>
						<td><input name="company" value="${company}" /></td>
					</tr>
					<tr>
						<td>Username:</td>
						<td><input name="username" value="${username}" /></td>
					</tr>
					<tr>
						<td>Password:</td>
						<td><input name="password" value="${password}"
							type="password" /></td>
					</tr>
					<tr>
						<td>Confirm Password:</td>
						<td><input name="passwordCheck" type="password" /></td>
					</tr>
					<tr>
						<td>Email:</td>
						<td><input name="email" value="${email}" /></td>
					</tr>
					<tr>
						<td colspan="2"><g:submitButton name="create" value="Create" /></td>
					</tr>

				</table>
			</form>
		</div>
		<div id="LJ">
		<form name="register" controller="LoginController" action="index2">
				<table>
					<tr>
						<td>First Name:</td>
						<td><input name="fName" value="${fName}" /></td>
					</tr>
					<tr>
						<td>Last Name:</td>
						<td><input name="lName" value="${lName}" /></td>
					</tr>
					<tr>
						<td>Address:</td>
						<td><input name="address" value="${address}" /></td>
					</tr>
					<tr>
						<td>City:</td>
						<td><input name="city" value="${city}" /></td>
					</tr>
					<tr>
						<td>Company/Organization:</td>
						<td><input name="company" value="${company}" /></td>
					</tr>
					<tr>
						<td>State:</td>
						<td><select>
						<option value="AL">AL</option>
						<option value="AK">AK</option>
						<option value="AZ">AZ</option>
						<option value="AR">AR</option>
						<option value="CA">CA</option>
						<option value="CO">CO</option>
						<option value="CT">CT</option>
						<option value="DE">DE</option>
						<option value="FL">FL</option>
						<option value="GA">GA</option>
						<option value="HI">HI</option>
						<option value="ID">ID</option>
						<option value="IL">IL</option>
						<option value="IN">IN</option>
						<option value="IA">IA</option>
						<option value="KS">KS</option>
						<option value="KY">KY</option>
						<option value="LA">LA</option>
						<option value="ME">ME</option>
						<option value="NV">NV</option>
						<option value="NH">NH</option>
						<option value="NJ">NJ</option>
						<option value="NM">NM</option>
						<option value="NY">NY</option>
						<option value="NC">NC</option>
						<option value="ND">ND</option>
						<option value="OH">OH</option>
						<option value="OK">OK</option>
						<option value="OR">OR</option>
						<option value="PA">PA</option>
						<option value="RI">RI</option>
						<option value="SC">SC</option>
						<option value="SD">SD</option>
						<option value="TN">TN</option>
						<option value="TX">TX</option>
						<option value="UT">UT</option>
						<option value="VT">VT</option>
						<option value="VA">VA</option>
						<option value="WA">WA</option>
						<option value="WV">WV</option>
						<option value="WI">WI</option>
						<option value="WY">WY</option>
						<option value="GU">Guam</option>
						<option value="PR">Puerto Rico</option>					
						</select></td>
					</tr>
					<tr>
						<td>Zip Code:</td>
						<td><input name="zip" value="${zip}" /></td>
					</tr>
					<tr>
						<td>Email:</td>
						<td><input name="email" value="${email}" /></td>
					</tr>
					<tr>
						<td>Telephone:</td>
						<td><input name="tele" value="${tele}" /></td>
					</tr>
					<tr>
						<td>Age:</td>
						<td><input name="age" value="${age}" /></td>
					</tr>
					<tr>
						<td>Biography:</td>
						<td><input name="bio" value="${bio}" /></td>
					</tr>
					<tr>
						<td>Picture:</td>
						<td><input type="file" name="pic" value="${pic}" /></td>
					</tr>
					<tr>
						<td>Parent First Name:</td>
						<td><input name="pfName" value="${pfName}" /></td>
					</tr>
					<tr>
						<td>Parent Last Name:</td>
						<td><input name="plName" value="${plName}" /></td>
					</tr>
					<tr>
						<td>Parent Email:</td>
						<td><input name="pemail" value="${pemail}" /></td>
					</tr>
					<tr>
						<td>Parent Telephone:</td>
						<td><input name="pTele" value="${pTele}" /></td>
					</tr>
					<tr>
						<td>Username:</td>
						<td><input name="username" value="${username}" /></td>
					</tr>
					<tr>
						<td>Password:</td>
						<td><input name="password" value="${password}"
							type="password" /></td>
					</tr>
					<tr>
						<td>Confirm Password:</td>
						<td><input name="passwordCheck" type="password" /></td>
					</tr>					
					<tr>
						<td colspan="2"><g:submitButton name="create" value="Create" /></td>
					</tr>

				</table>
			</form>
		</div>
		
	</sec:ifNotLoggedIn>

	<sec:ifAllGranted roles="ROLE_ADMIN">
		<p>insert poop here</p>
		<p>
			<g:link controller="logout">sign out</g:link>
		</p>
	</sec:ifAllGranted>

	<sec:ifAllGranted roles="ROLE_USER">
		<p>insert user poop here</p>
		<p>
			<g:link controller="logout">sign out</g:link>
		</p>
	</sec:ifAllGranted>



</body>
</html>
